<script lang='ts' setup name='Menu'>  
 import { ref } from 'vue' 
 //获取
 import { useRouter } from "vue-router";

 //总的路由器
 const router = useRouter();

 //定义一个事件方法用于 编程式路由
 function selectMenu(path:string,indexPath:string){
  console.log(path,indexPath);
  router.push({path})
 }


</script>  
  
<template>  
        <el-menu
        active-text-color="#ffd04b"
        background-color="#545c64"
        class="el-menu-vertical-demo"
        default-active="2"
        text-color="#fff"
       @select="selectMenu"
      >
        <el-sub-menu index="1">
          <template #title>
            <el-icon><location /></el-icon>
            <span>系统管理</span>
          </template>
          <el-menu-item-group title="Group One">
            <el-menu-item index="/department">部门管理</el-menu-item>
            <el-menu-item index="/drug">药品管理</el-menu-item>
            <el-menu-item index="/uomg">网易云评论</el-menu-item>
            <el-menu-item index="/pinia">测试pinia框架</el-menu-item>
            <el-menu-item index="/pinia-setup">测试pinia框架(组合式的方式 setup的 store)</el-menu-item>
          </el-menu-item-group>
         
         
        </el-sub-menu>
        
      </el-menu>
</template>  
  
<style scoped>  

</style>  